#!/usr/bin/env bash
# Copyright (c) 2024 maminjie <canpool@163.com>
# SPDX-License-Identifier: MulanPSL-2.0

usage() {
    echo "usage: bash rpm_list.sh [repos]"
}

main() {
    if [[ "$1" =~ ^(-h|--help)$ ]]; then
        usage; exit
    fi
    repos="$1"
    repo_args=""
    for r in $repos; do
        repo_args="$repo_args --repo $r"
    done
    repoquery -q --qf="%{name}-%{version}-%{release}.%{arch}.rpm" --all --latest-limit=1 $repo_args
}

main "$@"
